package firstday;
//动物父类
public class Animal {
    String name;
    String type;
    String age;
    //1、父类函数
    public void cry(){
        System.out.println("动物发出叫声");
    }
    //2、构造方法
    public Animal(){}
    public Animal(String name, String type, String age) {
        this.name = name;
        this.type = type;
        this.age = age;
    }

    //3、加法重载
    //3.1两个数相加
    public Integer add(int a,int b){
        return a+b;
    }
    //3.2三个数相加
    public Integer add(int a,int b,int c){
        return a+b+c;
    }

    //4、et方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    //重写toString方法
    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", age='" + age + '\'' +
                '}';
    }
}
